#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//递归函数
int fac(int n)
{
	if(n<2)
		return 1;
	return n*fac(n-1);
}

//字符串逆序
char* reverse(char* s)
{
	if(s){
		char t ,*p=s,*q=(s+strlen(s)-1);
		while(p<q){
			t = *p;
			*p++ = *q;
			*q--=t;
		}
	}
	return s;
}

int test(void)
//int main(void)
{
	char s[1024];
	printf("4!==%d\n",fac(4));
	printf("8!==%d\n",fac(8));
	
	strcpy(s,"itcastcpp");
	printf("reversing 'itcastcpp', we get '%s'\n",reverse(s));
	return 0;
}